package www.openteam.com.presenter.realtime;

import java.util.HashMap;
import java.util.List;

import www.openteam.com.base.BasePresenter;
import www.openteam.com.bean.ProducePro;
import www.openteam.com.contract.realtime.ProduceScheduleContract;
import www.openteam.com.model.realtime.ProduceScheduleModel;
import www.openteam.com.mvp.IModel;
import www.openteam.com.ui.realtime.ProduceScheduleFragment;

/**
 * Created by kylin on 2017/1/5.
 */

public class ProduceSchedulePresenter extends BasePresenter<ProduceScheduleFragment>
        implements ProduceScheduleContract.ProduceSchedulePresenter {
    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new ProduceScheduleModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {

        HashMap<String, IModel> hashMap = new HashMap<>();
        hashMap.put("queryProd", models[0]);
        return hashMap;
    }

    @Override
    public void queryProd(String rdsno, String custid, String code, long startDate,
                          long endDate,
                          String stype, String moreCom,
                          int userId,String jMark,
                          int pageSize) {

        ((ProduceScheduleModel) getiModelMap().get("queryProd"))
                .queryProd(rdsno, custid, code, startDate, endDate,stype,moreCom,userId,jMark,pageSize, new ProduceScheduleModel.ProduceScheduleOnListener() {
                    @Override
                    public void queryPSSuccess(List<ProducePro.DataEntity> data) {
//                        data.get(0).setCustName("深圳开盟");
//                        data.get(1).setCustName("深圳开盟");
//                        data.get(2).setCustName("深圳开盟");
//                        data.get(3).setCustName("深圳开盟");
                        getIView().queryPSSuccess(data);
                    }

                    @Override
                    public void queryPSFail(String failMsg) {

                        getIView().queryPSFail(failMsg);
                    }
                });

    }
}
